/*<summary>
Created By : Preeti
Created On : 9/20/2008
Class Name : PatientProcudureDetail_LoadMapper
Used In    : 
------------------------------------------------------------------------
Modification Log  
------------------------------------------------------------------------
Created By        Modified By         Remarks                             
-----------       ------------        ----------------------------------
                                                                          
------------------------------------------------------------------------
</summary>*/


using System.Xml;
using System.Data;
using System;
using Utils;
using System.Data.SqlClient;

namespace InPatientCntroller
{
    public class PatientProcudureDetail_DataLoader
    {
        public PatientProcudureDetail Get_PatientProcudureDetail_DATA(string ID)
        {
            PatientProcudureDetail objPatientProcudureDetail = new PatientProcudureDetail();
            ezUtilsAdapter DBL = new ezUtilsAdapter();
            DataChecker dtc = new DataChecker();
            DataSet ds = new DataSet();


            try
            {
                ds = DBL.RunSPReturnDataSet("SP_GetPatientProcudureDetail", "TR", new SqlParameter("@vchID", ID));
                if (ds.Tables[0].Rows.Count > 0)
                {
                    DataRow dr = ds.Tables[0].Rows[0];
                    objPatientProcudureDetail.CRNumber = Convert.ToString(dr["CRNumber"]);
                    objPatientProcudureDetail.ProcedureName = Convert.ToString(dr["ProcedureName"]);
                    objPatientProcudureDetail.ProcedureCode = Convert.ToString(dr["ProcedureCode"]);
                    objPatientProcudureDetail.ProcedureDate = Convert.ToString(dr["ProcedureDate"]);
                    objPatientProcudureDetail.ProcedureTime = Convert.ToString(dr["ProcedureTime"]);
                    objPatientProcudureDetail.Remarks = Convert.ToString(dr["Remarks"]);
                    objPatientProcudureDetail.Consultant = Convert.ToString(dr["Consultant"]);
                    objPatientProcudureDetail.ReportId = Convert.ToString(dr["ReportId"]);
                    objPatientProcudureDetail.Billing = Convert.ToString(dr["Billing"]);
                    return objPatientProcudureDetail;
                }
                else
                {
                    return objPatientProcudureDetail;
                }
            }
            catch (SqlException ex)
            {
                string errorMessage = String.Format(
                    "An Error Occurred While Loading the PatientProcudureDetail Information to the DB. Message: {0}", ex.Message);
                return objPatientProcudureDetail;
            }
            finally
            {
                DBL.Dispose();
                dtc.Dispose();
                ds.Dispose();

            }
        }

        public void Dispose()
        {
            this.Dispose(true);
            System.GC.SuppressFinalize(this);
        }

        private void Dispose(bool disposing)
        {
        }


    }
}